use std::str::FromStr;

use warp::reply::{Json, WithStatus};

use crate::core::git::REPO;
use crate::router::basic;
use crate::{make_resp, require_token};

pub fn status(authorization: String) -> WithStatus<Json> {
	require_token!(authorization);

	let commit_id = REPO.lock().unwrap().head().unwrap().target().unwrap();

	make_resp!(
		0,
		String::from_str("echest server (version in data)").unwrap(),
		commit_id.to_string()
	)
}
